﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Ue.Infrastructure.EntityFactoryFramework;
using Ue.Qcdz.Domain.SinglePages;
using Ue.Framework.Data;
namespace Ue.Qcdz.Repositories.SinglePages
{
    public class SinglePageFactory : IEntityFactory<SinglePage>
    {

        internal class FieldNames : FieldNamesBase
        {
            public const string Title = "Title";
            public const string Content = "Content";
            public const string ImageUrl = "ImageUrl";
            public const string CategoryId = "CategoryId";
            public const string DisplayOrder = "DisplayOrder";
            public const string Status = "Status";

        }





        #region IEntityFactory<SinglePage> 成员

        public SinglePage BuildEntity(System.Data.IDataReader reader)
        {
            return new SinglePageProxy(
               reader.Get<Guid>(SinglePageFactory.FieldNames.EntityKey),
               reader.Get<string>(SinglePageFactory.FieldNames.Title),
               reader.Get<string>(SinglePageFactory.FieldNames.Content),
               reader.Get<string>(SinglePageFactory.FieldNames.ImageUrl),
               reader.Get<string>(SinglePageFactory.FieldNames.CategoryId),
               reader.Get<int>(SinglePageFactory.FieldNames.DisplayOrder),
               reader.Get<int>(SinglePageFactory.FieldNames.Status),
               reader.Get<DateTime>(SinglePageFactory.FieldNames.CreateOn)
            );
        }

        #endregion
    }
}
